const Koa = require('koa');
const { router } = require('./router.js');
const koaBody = require('koa-body')();
var cors = require('koa2-cors'); //解决跨域

const app = new Koa();

app.use(cors());

app.use(async (ctx, next) => {
  console.log(`Process ${ctx.request.method} ${ctx.request.url}...`);
  await next();
});

// add router middleware:
app.use(router.routes());

app.listen(3000, () => {
  console.log('模拟数据启动成功，端口号：3000')
});